    # -*- coding: utf-8 -*-

import webapp2
from Model import *
import datetime
from google.appengine.ext import ndb
import logging
from racesManager import *
from usersManager import *
from liveRaceManager import *
from startRaceManager import *
from raceFinishedManager import *
from endRaceManager import *
from InviteManager import *
from CronManager import *
from recordManager import *
from quickRaceManager import *
from startRaceTasksManager import *

class MainHandler(webapp2.RequestHandler):
    def get(self):
        self.response.out.write('Hello world!')
        # self.response.write('          ')
        #user1 = User(Name="Dana", Email="dana@gmail.com", Gender="Female",Grade=97, Birthdate=datetime.date(1988, 11, 3))
        #user1.put()
        #race1 = Race(Manager=user1.key, Participants=[user1.key], Distance=4, Status=RaceStatus.Before, Tags="#4km")
        #race1.put()
        # currentStats = CurrentStats(Race=race1.key, Racer=user1.key, Speed=10.0, ActualDistance=3.0)
        # currentStats.put()


app = webapp2.WSGIApplication([('/', MainHandler), ('/liverace/updatestats', LiveRaceHandler),('/liverace/startRace', StartRaceHandler),\
							   ('/racefinished/updatescore', RaceFinishedHandler),('/liverace/startRaceTasks',startRaceTasksHandler),\
                               ('/quickrace/addtorace', QuickRaceHandler),\
                               ('/invitefriend/checkexcist', CheckExcistHandler),\
                               ('/crontasks/test', CronTestHandler),\
                               ('/registerDevice', DeviceRegisterHandler),\
                               ('/racesManager/futureRaces', AllFutureRacesHandler),('/racesManager/myRaces', MyRacesHandler),\
                               ('/racesManager/futureRacesFilterByDistance', FilterDistanceFutureRacesHandler),\
                               ('/racesManager/futureRacesFilterByDate', FilterDateFutureRacesHandler),\
                               ('/racesManager/userIsReady', AddUserToReady), ('/newUser', NewUserHandler),\
                               ('/racesManager/newRace', NewRaceHandler),('/currentStats', NewCurrentStatsHandler),\
                               ('/racesManager/addUserToRace', AddUserToRace), ('/racesManager/removeUserFromRace', RemoveUserFromRace),\
                               ('/racesManager/participants', ParticipantsOfRaceHandler), ('/signIn', SignInHandler),\
                               ('/getAchievements', AchievementsHandler),\
                               ('/nickname', NicknameHandler), ('/recordManager/myRaces', MyHistoryRacesHandler)], debug=True)
